<template>
    <div class="login-box">
        <div class="header">
            <div class="nav">
                <p>
                    <span>中文(简体)</span>
                    <i class="iconfont icon-arrow_drop_down"></i>
                </p>
                <p>
                    <i class="iconfont icon-anquan"></i>
                    <span class="help">帮助</span>
                </p>
            </div>
            <div class="banner">
                <h3 class="title">小米账号登录</h3>
                <img src="@/assets/img/Login/logo.svg" alt="">
                <p class="welcome">欢迎登录小米有品</p>
            </div>
        </div>
        <suspense>
            <template #fallback>
                <!-- 应变计划 -->
                <p>loading...</p>
            </template>
            <component :is="FuncMap[loginMethod]"></component>
        </suspense>
        <el-footer>
            <div class="login-problem">
                <span v-show="loginMethod === 'uid'" @click="loginMethod = 'mobile'">手机登录</span>
                <span v-show="loginMethod === 'mobile'" @click="loginMethod = 'uid'">账号密码登录</span>
                <span>｜</span>
                <span>立即注册</span>
                <span v-show="loginMethod === 'uid'">｜</span>
                <span v-show="loginMethod === 'uid'">忘记密码？</span>
            </div>
            <p class="else-login">其他方式登录</p>
            <div class="other-login">
                <img src="@/assets/img/Login/weixin.png" alt="">
                <img src="@/assets/img/Login/weibo.png" alt="">
                <img src="@/assets/img/Login/iphone.png" alt="">
            </div>
        </el-footer>
    </div>
</template>
<script setup lang="ts">
import { defineAsyncComponent, ref } from 'vue'

const loginMethod = ref<string>('mobile')
interface FuncMap {
    [key: string]: any
}
const FuncMap: FuncMap = {
    'uid': defineAsyncComponent(() => import('./UidLogin.vue')),
    'mobile': defineAsyncComponent(() => import('./MobileLogin.vue'))
}


</script>


<style lang="stylus" scoped>
.login-box
    display flex
    flex-direction column
    height 100vh

.nav
    box-sizing border-box
    width 100vw
    height 11.2vw
    padding 0.642361rem 1.388889rem
    display flex
    justify-content space-between
    align-items center

.nav p
    display flex
    justify-content center
    align-items center

.nav span
    color: rgba(0,0,0,50%);
    font-size 0.659722rem;
    line-height 5.86vw


.help
    padding-left 5.86vw

.banner
    display flex
    flex-direction column
    align-items: center;

.banner .title
    font-weight: 600
    height 12vw
    line-height 12vw
    padding: 0.173611rem 1.388889rem 1.041667rem;

.banner img
    margin-top 2.5vw
    height 12.8vw
    width  12.8vw

.banner .welcome
    margin-top 4vw
    margin-bottom 2.395833rem
    color rgba(0,0,0,0.6)
    font-size 0.694444rem

.el-footer
    flex-grow 1
    text-align center
    margin-top: 1.215278rem

.else-login
    color rgba(0,0,0,20%)
    height: 0.78125rem
    font-size: 0.590278rem
    line-height: 0.781250rem
    margin-top: 1.215278rem


.other-login
    margin-top 0.659722rem
    display flex
    justify-content center
    
    
   
.other-login img
    width 8.5vw
    height 8.5vw
    margin 0 0.607639rem

.login-problem
    color: rgba(0, 0, 0, 0.54);
    display: flex;
    font-size: 0.659722rem;
    margin-top: 1.041667rem;
    align-items: center;
    line-height: 0.885417rem;
    justify-content: center;
</style>